var swappSpyConfig = {

	updateProxySettings: function() {
		var proxyHost = window.document.getElementById("swappspy-proxy-host").value;
		var proxyPort = window.document.getElementById("swappspy-proxy-port").value;
		//alert(proxyHost+":"+proxyPort);
		
		var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                    .getService(Components.interfaces.nsIPrefService);
		prefs = prefs.getBranch("extensions.swappspy.");
		prefs.setCharPref("http", proxyHost);
		prefs.setIntPref("http_port", proxyPort);
		
		if(prefs.getBoolPref("active")){
			var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                    .getService(Components.interfaces.nsIPrefService);
			prefs = prefs.getBranch("network.proxy.");
			prefs.setCharPref("http", proxyHost);
			prefs.setIntPref("http_port", proxyPort);
		}
	}
	
}